package your.name.clock.model;
//a new comment
import java.text.DateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.Random;

public class ClockBean {
	static Random rng = null;

	public ClockBean() {
		// here, new date is used to initialize random numbers
		if (rng == null) {
			rng = new Random(new Date().getTime());
		}
	}

	public String getCurrentTimeFormatted() {
		DateFormat df = null;
		int ifmt = rng.nextInt(4);
		switch (ifmt) {
		case 0: {
			df = DateFormat.getDateTimeInstance(DateFormat.FULL,
					DateFormat.FULL);
			break;
		}
		case 1: {
			df = DateFormat.getDateTimeInstance(DateFormat.LONG,
					DateFormat.LONG);
			break;
		}
		case 2: {
			df = DateFormat.getDateTimeInstance(DateFormat.MEDIUM,
					DateFormat.MEDIUM);
			break;
		}
		case 3: {
			df = DateFormat.getDateTimeInstance(DateFormat.SHORT,
					DateFormat.SHORT);
			break;
		}
		}
		return df.format(Calendar.getInstance().getTime());
	}
}
